
/**
 *  Look at the execution times of a thread during the process
 *  @author 原映雪
 *
 */

public class Profiler {
    private static final  ThreadLocal<Long> TIME_READLOCAL = new ThreadLocal<Long>(){
        @Override
        protected Long initialValue(){
            return System.currentTimeMillis();
        }
    };
    public static final void begin(){
        TIME_READLOCAL.set(System.currentTimeMillis());
    }
    public static final long end(){
        return System.currentTimeMillis() - TIME_READLOCAL.get();
    }

    public static void main(String[] args) throws InterruptedException {
        Profiler.begin();
        Thread.sleep(1);
        System.out.println(Profiler.end() + "mills");
    }

}
